package org.prem.hibernate;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

public class Main9 {

	public static void main(String args[]){
		Student9 student9 = new Student9();
		student9.setStudent_name("prem9");
		
		StudentDetail9  studentDetail9= new StudentDetail9();
		studentDetail9.setStudent_mobile_number("9994096934");
		studentDetail9.setStudent9(student9);
		student9.setStudentDetail9(studentDetail9);
		
		SessionFactory sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();
		Session session = sessionFactory.openSession();
		session.beginTransaction();
		//session.save(studentDetail9);
		session.save(student9);
		
		session.getTransaction().commit();
		session.close();
		sessionFactory.close();
	}

}
